package core.controller.cmds;

import core.controller.CommandController;
import core.dal.WeightFunctionality;
import exceptions.UserNotFoundException;

public class CalculateNettoCMD implements ICmd{

	CommandController cc;
	WeightFunctionality functionality;
	final String level = "WeightApplication";
	ICmd nextCMD;
	
	public CalculateNettoCMD(CommandController commandController, WeightFunctionality wF){
		this.cc = commandController;
		this.functionality = wF;
	}	
	
	@Override
	public void setNextCmd(ICmd nextCmd) {
		this.nextCMD = nextCmd;
		
	}

	@Override
	public void execute(String cmd) {
		if (cmd.equals("calculateNetto")) {
			double brutto;
			double tara;
			
			cc.getTUI().showOutput("Enter brutto:");
			brutto = Double.parseDouble(cc.getTUI().getInput());
			cc.getTUI().showOutput("Enter Tara:");
			tara = Double.parseDouble(cc.getTUI().getInput());
			
			cc.getTUI().showOutput("Netto is: " + functionality.calculateNetto(brutto, tara));
		}

		if (nextCMD != null) {
			nextCMD.execute(cmd);
		}
	}

	@Override
	public String getInfo() {
		return "calculateNetto - Calculates the netto";
		
	}

	@Override
	public String getLevel() {
		return this.level;
		
	}

	
}

